<div class="modal fade " id="addInstitutionInvestModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document" style="width: 80%">
        <div class="box box-info">
            <div class="box-header with-border">
                <h3 class="box-title">机构投资需求</h3>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form class="form-horizontal">
                <div class="box-body">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">机构名称</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_name" type="text" class="form-control"
                                   disabled="disabled">
                            <input id="addInstitutionInvestModal_institutionId" type="hidden">
                            <input id="addInstitutionInvestModal_inde" type="hidden">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">总投资规模（亿元）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_totalInvestScale" type="text" class="form-control">
                        </div>
                        <label class="col-sm-2 control-label">已投规模（亿元）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_finishInvestScale" type="text" class="form-control">
                        </div>
                        <label class="col-sm-2 control-label">剩余规模（亿元）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_residueInvestScale" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">信托剩余规模（亿元）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_xintuoScale" type="text" class="form-control">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_xintuoScaleRemark" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-3 control-label">单个项目投资规模上限（亿元）：</label>
                        <div class="col-sm-2">
                            <input id="addInstitutionInvestModal_maxProjectScale" type="text" class="form-control">
                        </div>
                        <label class="col-sm-4 control-label">单个主体投资规模上限（亿元）：</label>
                        <div class="col-sm-2">
                            <input id="addInstitutionInvestModal_maxInstitutionScale" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label pull-left">投资者收益率最低要求（%）：</label>
                        <div class="col-sm-2">
                            <input id="addInstitutionInvestModal_minYield" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label pull-left">其中：基础设施保债（%）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_minBaozYield" type="text" class="form-control">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">不动产保债（%）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_minBudongYield" type="text" class="form-control">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">信托计划（%）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_minXingtuoYield" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">可接受最长期限（年）：</label>
                        <div class="col-sm-3">
                            <input id="addInstitutionInvestModal_maxTimelimit" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-3 control-label pull-left">其中：基础设施保债（年）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_maxBaozTimelimit" type="text" class="form-control">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">不动产保债（年）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_maxBudongTimelimit" type="text" class="form-control">
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">信托计划（年）：</label>
                        <div class="col-sm-1">
                            <input id="addInstitutionInvestModal_maxXingtuoTimelimit" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受永续债：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowYongxu">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowYongxuRemark" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受两高一剩行业：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowResidue">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowResidueRemark" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受城投平台行业：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowCityInvest">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowCityInvestRemark" type="text"
                                   class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受房地产行业：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowEstate">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowEstateRemark" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">禁投领域：</label>
                        <div class="col-sm-8">
                            <input id="addInstitutionInvestModal_investProhibition" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受AA+：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowAa">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowAaRemark" type="text" class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受民企：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowCorporation">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowCorporationRemark" type="text"
                                   class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受免增信：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowMzx">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowMzxRemark" type="text"
                                   class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受财顾类信托：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowCglxt">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowCglxtRemark" type="text"
                                   class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">是否接受资产支持计划：</label>
                        <div class="col-sm-1">
                            <select class="form-control  select2" id="addInstitutionInvestModal_isAllowZczcjh">
                                <option value="-1">请选择</option>
                                <option value="1">是</option>
                                <option value="0">否</option>
                            </select>
                        </div>
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">详细情况：</label>
                        <div class="col-sm-5">
                            <input id="addInstitutionInvestModal_isAllowZczcjhRemark" type="text"
                                   class="form-control">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">内部流程时长（天）：</label>
                        <div class="col-sm-8">
                            <input id="addInstitutionInvestModal_innerProcess" type="text" class="form-control" >
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label pull-left">备注：</label>
                        <div class="col-sm-6">
                            <textarea id="addInstitutionInvestModal_remark" class="form-control" rows="3" placeholder="备注信息"></textarea>
                        </div>
                    </div>
                </div>
                <!-- /.box-body -->
                <div class="box-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button id="btnSubmit" type="button" class="btn btn-primary pull-right"
                            onclick="addInstitutionInvestModal_save()">保存
                    </button>
                </div>
                <!-- /.box-footer -->
            </form>
        </div>
    </div>
</div>
<script>

    function addInstitutionInvestModal_init() {
        $("#addInstitutionInvestModal_inde").val("");
        $("#addInstitutionInvestModal_name").val("");
        $("#addInstitutionInvestModal_institutionId").val("");
        $("#addInstitutionInvestModal_totalInvestScale").val("");
        $("#addInstitutionInvestModal_finishInvestScale").val("");
        $("#addInstitutionInvestModal_residueInvestScale").val("");
        $("#addInstitutionInvestModal_maxProjectScale").val("");
        $("#addInstitutionInvestModal_maxInstitutionScale").val("");
        $("#addInstitutionInvestModal_minYield").val("");
        $("#addInstitutionInvestModal_minBaozYield").val("");
        $("#addInstitutionInvestModal_minBudongYield").val("");
        $("#addInstitutionInvestModal_minXingtuoYield").val("");
        $("#addInstitutionInvestModal_maxTimelimit").val("");
        $("#addInstitutionInvestModal_maxBaozTimelimit").val("");
        $("#addInstitutionInvestModal_maxBudongTimelimit").val("");
        $("#addInstitutionInvestModal_maxXingtuoTimelimit").val("");
        $("#addInstitutionInvestModal_isAllowYongxuRemark").val("");
        $("#addInstitutionInvestModal_isAllowResidueRemark").val("");
        $("#addInstitutionInvestModal_isAllowCityInvestRemark").val("");
        $("#addInstitutionInvestModal_isAllowEstateRemark").val("");
        $("#addInstitutionInvestModal_investProhibition").val("");
        $("#addInstitutionInvestModal_isAllowAaRemark").val("");
        $("#addInstitutionInvestModal_isAllowCorporationRemark").val("");
        $("#addInstitutionInvestModal_innerProcess").val("");
        $("#addInstitutionInvestModal_remark").val("");

        $("#addInstitutionInvestModal_xintuoScaleRemark").val("");
        $("#addInstitutionInvestModal_isAllowMzxRemark").val("");
        $("#addInstitutionInvestModal_isAllowCglxtRemark").val("");
        $("#addInstitutionInvestModal_isAllowZczcjhRemark").val("");

        $("#addInstitutionInvestModal_xintuoScale").val("");

        var json3 = "[{\"id\":\"\",\"text\":\"请选择\"}" +
                ",{\"id\":\"1\",\"text\":\"是\"}" +
                ",{\"id\":\"0\",\"text\":\"否\"}]";
        $("#addInstitutionInvestModal_isAllowYongxu").empty();
        $("#addInstitutionInvestModal_isAllowYongxu").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowResidue").empty();
        $("#addInstitutionInvestModal_isAllowResidue").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowCityInvest").empty();
        $("#addInstitutionInvestModal_isAllowCityInvest").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowEstate").empty();
        $("#addInstitutionInvestModal_isAllowEstate").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowAa").empty();
        $("#addInstitutionInvestModal_isAllowAa").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowCorporation").empty();
        $("#addInstitutionInvestModal_isAllowCorporation").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowMzx").empty();
        $("#addInstitutionInvestModal_isAllowMzx").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowCglxt").empty();
        $("#addInstitutionInvestModal_isAllowCglxt").select2({data: JSON.parse(json3)});

        $("#addInstitutionInvestModal_isAllowZczcjh").empty();
        $("#addInstitutionInvestModal_isAllowZczcjh").select2({data: JSON.parse(json3)});

    }

    function addInstitutionInvestModal_setValue(inde) {
        var options = $("#table1").bootstrapTable("getData");
        var row = options[inde];
        $("#addInstitutionInvestModal_inde").val(inde);
        $("#addInstitutionInvestModal_name").val(row.name);
        $("#addInstitutionInvestModal_institutionId").val(row.id);
        $("#addInstitutionInvestModal_totalInvestScale").val(row.totalInvestScale);
        $("#addInstitutionInvestModal_finishInvestScale").val(row.finishInvestScale);
        $("#addInstitutionInvestModal_residueInvestScale").val(row.residueInvestScale);
        $("#addInstitutionInvestModal_maxProjectScale").val(row.maxProjectScale);
        $("#addInstitutionInvestModal_maxInstitutionScale").val(row.maxInstitutionScale);
        $("#addInstitutionInvestModal_minYield").val(row.minYield);
        $("#addInstitutionInvestModal_minBaozYield").val(row.minBaozYield);
        $("#addInstitutionInvestModal_minBudongYield").val(row.minBudongYield);
        $("#addInstitutionInvestModal_minXingtuoYield").val(row.minXingtuoYield);
        $("#addInstitutionInvestModal_maxTimelimit").val(row.maxTimelimit);
        $("#addInstitutionInvestModal_maxBaozTimelimit").val(row.maxBaozTimelimit);
        $("#addInstitutionInvestModal_maxBudongTimelimit").val(row.maxBudongTimelimit);
        $("#addInstitutionInvestModal_maxXingtuoTimelimit").val(row.maxXingtuoTimelimit);
        $("#addInstitutionInvestModal_isAllowYongxuRemark").val(row.isAllowYongxuRemark);
        $("#addInstitutionInvestModal_isAllowResidueRemark").val(row.isAllowResidueRemark);
        $("#addInstitutionInvestModal_isAllowCityInvestRemark").val(row.isAllowCityInvestRemark);
        $("#addInstitutionInvestModal_isAllowEstateRemark").val(row.isAllowEstateRemark);
        $("#addInstitutionInvestModal_investProhibition").val(row.investProhibition);
        $("#addInstitutionInvestModal_isAllowAaRemark").val(row.isAllowAaRemark);
        $("#addInstitutionInvestModal_isAllowCorporationRemark").val(row.isAllowCorporationRemark);
        $("#addInstitutionInvestModal_innerProcess").val(row.innerProcess);
        $("#addInstitutionInvestModal_remark").val(row.remark);
        $("#addInstitutionInvestModal_xintuoScale").val(row.xintuoScale);
        $("#addInstitutionInvestModal_xintuoScaleRemark").val(row.xintuoScaleRemark);
        $("#addInstitutionInvestModal_isAllowMzxRemark").val(row.isAllowMzxRemark);
        $("#addInstitutionInvestModal_isAllowCglxtRemark").val(row.isAllowCglxtRemark);
        $("#addInstitutionInvestModal_isAllowZczcjhRemark").val(row.isAllowZczcjhRemark);

        $("#addInstitutionInvestModal_isAllowYongxu").select2("val",row.isAllowYongxu);
        $("#addInstitutionInvestModal_isAllowResidue").select2("val",row.isAllowResidue);
        $("#addInstitutionInvestModal_isAllowCityInvest").select2("val",row.isAllowCityInvest);
        $("#addInstitutionInvestModal_isAllowEstate").select2("val",row.isAllowEstate);
        $("#addInstitutionInvestModal_isAllowAa").select2("val",row.isAllowAa);
        $("#addInstitutionInvestModal_isAllowCorporation").select2("val",row.isAllowCorporation);
        $("#addInstitutionInvestModal_isAllowMzx").select2("val",row.isAllowMzx);
        $("#addInstitutionInvestModal_isAllowCglxt").select2("val",row.isAllowCglxt);
        $("#addInstitutionInvestModal_isAllowZczcjh").select2("val",row.isAllowZczcjh);

    }

    function setData(field,data,row){
        var d = $("#addInstitutionInvestModal_" +field ).val();
        if(row[field] == d || (d == "" && row[field] == undefined))
            return;
        data[field] = d ;
    }

    function addInstitutionInvestModal_save() {
        var inde = $("#addInstitutionInvestModal_inde").val() ;
        var options = $("#table1").bootstrapTable("getData");
        var row = options[inde];
        var data = {} ;
        setData("totalInvestScale",data,row);
        setData("finishInvestScale",data,row);
        setData("residueInvestScale",data,row);
        setData("maxProjectScale",data,row);
        setData("maxInstitutionScale",data,row);
        setData("minYield",data,row);
        setData("minBaozYield",data,row);
        setData("minBudongYield",data,row);
        setData("minXingtuoYield",data,row);
        setData("maxTimelimit",data,row);
        setData("maxBaozTimelimit",data,row);
        setData("maxBudongTimelimit",data,row);
        setData("maxXingtuoTimelimit",data,row);
        setData("isAllowYongxuRemark",data,row);
        setData("isAllowResidueRemark",data,row);
        setData("isAllowCityInvestRemark",data,row);
        setData("isAllowEstateRemark",data,row);
        setData("investProhibition",data,row);
        setData("isAllowAaRemark",data,row);
        setData("isAllowCorporationRemark",data,row);
        setData("innerProcess",data,row);
        setData("remark",data,row);
        setData("isAllowYongxu",data,row);
        setData("isAllowResidue",data,row);
        setData("isAllowCityInvest",data,row);
        setData("isAllowEstate",data,row);
        setData("isAllowAa",data,row);
        setData("isAllowCorporation",data,row);
        setData("xintuoScale",data,row);
        setData("xintuoScaleRemark",data,row);
        setData("isAllowMzx",data,row);
        setData("isAllowMzxRemark",data,row);
        setData("isAllowCglxt",data,row);
        setData("isAllowCglxtRemark",data,row);
        setData("isAllowZczcjh",data,row);
        setData("isAllowZczcjhRemark",data,row);

        console.log(data);
        setData("institutionId",data,row);

        var url = "/institutioninvest/modify";
        postReq(url, data, function (result) {
            if (result.success) {
                toastr['success']('操作成功', '提示');
                $("#table1").bootstrapTable("refresh");
                $("#addInstitutionInvestModal").modal("hide");
            } else {
                toastr['error'](result.msg, '提示');
            }
        });
    }
</script>
